/**
 * 
 */
package gamePlay;

import interfaces.Game;
import datatype.Question;
import datatype.Statistics;

/**
 * @author Yuval
 * implements the Game interface, all the functions control the game flow 
 */
public abstract class AbsGame implements Game {

	protected AbsChain chain;
	protected Statistics stats = new Statistics();
	protected boolean isAskForMore = false;

	public AbsChain getChain() {
		return chain;
	}

	public synchronized void setChain(AbsChain chain) {
		this.chain = chain;
	}

	public Statistics getStats() {
		return stats;
	}

	public void setStats(Statistics stats) {
		this.stats = stats;
	}

	@Override
	public Question startGame() {
		return chain.startChain(System.currentTimeMillis());
	}

	@Override
	public void finishGame() {
		chain.finish(System.currentTimeMillis(), stats);

	}

	@Override
	public boolean chooseAnswer(int answer) {
		return chain.chooseAnswer(answer);
	}


}
